package org.gvp.manager.service.impl;

import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.gvp.manager.pojo.GatewayRouteFactory;
import org.gvp.manager.repository.GatewayRouteFactoryRepository;
import org.gvp.manager.service.GatewayRouteFactoryService;
import org.springframework.stereotype.Service;

import java.util.List;

@Log4j2
@Service
@RequiredArgsConstructor
public class GatewayRouteServiceFactoryImpl implements GatewayRouteFactoryService {
    private final GatewayRouteFactoryRepository routeFactoryRepository;

    @Override
    public List<GatewayRouteFactory> findListByRouterId(Integer routeId) {
        log.debug("根据路由的id获取路由的工厂信息列表: {}", routeId);
        return this.routeFactoryRepository.searchByRouterId(routeId);
    }

    @Override
    public int edit(GatewayRouteFactory pojo) {
        log.debug("更新路由工厂信息: {}", pojo);
        return this.routeFactoryRepository.modify(pojo);
    }

    @Override
    public int save(GatewayRouteFactory pojo) {
        log.debug("添加路由工厂信息: {}", pojo);
        return this.routeFactoryRepository.append(pojo);
    }
}
